package com.imachen.ymcc.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.imachen.ymcc.domain.Teacher;
import com.imachen.ymcc.mapper.TeacherMapper;
import com.imachen.ymcc.service.ITeacherService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 老师表 服务实现类
 * </p>
 *
 * @author imachen
 * @since 2022-09-30
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {

    @Override
    public Page<Teacher> selectPage(Page<Teacher> page, String keyword) {
        Wrapper<Teacher> wrapper = new EntityWrapper<>();
        if (!StringUtils.isEmpty(keyword)){
            wrapper.like("name",keyword).or()
                    .like("intro",keyword).or()
                    .like("position",keyword);
        }
        return super.selectPage(page,wrapper);
    }
}
